package com.jr.bitcoin;

import com.jr.bitcoin.Rpc.GettBestBlockHash;
import com.jr.bitcoin.address.Address;
import com.jr.bitcoin.bean.HotVideo;
import com.jr.bitcoin.request.service.HotVideoService;


import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String []args){
//        System.out.println("hello world");
//        HotVideoService service = new HotVideoService();
//        List<HotVideo> list = service.getHotVideo();
//        System.out.println(list.size());
        printMenu();
    }

    public static void printMenu(){
        System.out.println("====比特币系统设计作业=====");
        System.out.println("已实现以下功能：");
        System.out.println("1.热门视频获取 2.和比特币客户通信 3.比特币地址推导");
        while (true){
            userInput();
        }
//        userInput();

//        System.out.println("请输入要使用的功能序号：");
//        System.out.println("1.热门视频获取 2.和比特币客户通信 3.比特币地址推导");
//        Scanner scanner = new Scanner(System.in);
//        int num = scanner.nextInt();
//        switch (num){
//            case 1:
//                break;
//            case 2:
//                break;
//            case 3:
//                break;
//            default:
//                System.out.println("输入有误，重新输入！");
//                break;
//       }
    }
    public static void userInput(){
        System.out.println("请输入要使用的功能序号：");
        System.out.println("1.热门视频获取 2.和比特币客户通信 3.比特币地址推导");
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        switch (num){
            case 1:
                HotVideoService hotVideo = new HotVideoService();
                List<HotVideo> videoList = hotVideo.getHotVideo();
                for (HotVideo video :videoList){
                    System.out.println(video.getShare_url());
                }
//                List<HotVideo> hotVideo = HotVideoService.getHotVideo();
//                System.out.println("查询到的热门视频：" + "有" + hotVideo.size() + "条");
//                int y = 0;
//                for (Object i : hotVideo) {
//                    System.out.println("第" + (y + 1) + "条");
//                    System.out.println("作者：" + hotVideo.get(y).getAuthor());
//                    System.out.println("标题：" + hotVideo.get(y).getTitle());
//                    System.out.println("视频链接：" + hotVideo.get(y).getShare_url());
//                    System.out.println("视频封面：" + hotVideo.get(y).getItem_cover());
//                    System.out.println("热度指数：" + hotVideo.get(y).getPlay_count());
//                    System.out.println("视频播放数：" + hotVideo.get(y).getPlay_count());
//                    System.out.println("视频点赞数：" + hotVideo.get(y).getDigg_count());
//                    System.out.println("视频评论数：" + hotVideo.get(y).getComment_count());
//                    System.out.println("视频热词：" + hotVideo.get(y).getItem_cover());
//                    y++;
//                    System.out.println();
//                }
                break;
            case 2:
                System.out.println(GettBestBlockHash.getBestBlockHash());
                break;
            case 3:
                System.out.println(Address.generateKeys());
                break;
            case 0:
                System.out.println("谢谢");
                System.exit(0);
            default:
                System.out.println("输入有误，请重新输入！");
                break;
        }

    }
}
